import { observable, action } from 'mobx';
import { WeaTableNew } from 'comsMobx';
import { WeaTools, WeaLocaleProvider } from 'ecCom';

const { TableStore } = WeaTableNew;
import ListBaseStore from './ListBaseStore';
import Apis from '../apis/car';

const getLabel = WeaLocaleProvider.getLabel;
/**
 * 车辆查询Store
 */
export default class CarUseSingtonStore extends ListBaseStore {
  constructor() {
    super();
    this.title = getLabel(19018, '车辆使用情况');
    this.selectedKey = 'all';
  }

	// 加载列表数据
	@action doTableLoading = (params) => {
	  this.showLoading(true);
	  const commonParams = {
	    searchType: this.selectedKey,
	  };
	  this.tableStore = new TableStore();
	  const resultParams = { ...commonParams, ...params };
	  Apis.getCarUseSingtonList(resultParams).then(
	    action((result) => {
	      const sessionkey = result.sessionkey;
	      this.sessionkey = sessionkey;
	      this.tableStore.getDatas(sessionkey, 1);
	      this.showLoading(false);
	    }),
	  );
	}
}
